package com.zkl.spring;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TraceApplication {

    private final Logger logger = LoggerFactory.getLogger(TraceApplication.class);

    @RequestMapping(value = "/trace-2", method = RequestMethod.GET)
    public String trace(HttpServletRequest request) {
        logger.info(
                "===<call trace-2, X-B3-TraceId={}, X-B3-SpanId={},X-B3-ParentSpanId={},X-B3-Sampled={},X-Span-Name={}>===",
                request.getHeader("X-B3-TraceId"), request.getHeader("X-B3-SpanId"));
        return "Trace";
    }

}